create external table jms_dm.dm_customer_base_data_dt (
      customer_code string comment '客户编码' ,
      customer_name string comment '客户名字',
      customer_level string comment '客户等级',
      ordersource_code string comment '平台ID',
      ordersource_name string comment '平台名字',
      customer_type_id string comment '客户类型' ,
      customer_type_name string comment '客户类型名字',
      customer_category string comment '客户类别',
      customer_category_name string comment '客户类别名字',
      customer_attribute_id string comment '客户属性ID',
      customer_attribute_name string comment '客户属性名字',
      subordinate_agent_name string comment '所属代理区',
      subordinate_agent_code string  comment '所属代理区code',
      first_franchisee_id string comment '一级加盟商id'  ,
      first_franchisee_code string comment '一级加盟商code',
      first_franchisee_name string comment '一级加盟商' ,
      customer_belong_network_id string comment '客户所属网点ID',
      customer_belong_network_name string comment '分区日期',
      customer_province_id string comment '客户所属网点名字',
      customer_province_desc string comment '客户所属省份名字',
      customer_city_id string comment '客户所属城市id'  ,
      customer_city_desc string comment '客户所属城市名字',
      customer_area_id string  comment '客户所属区域id',
      customer_area_desc string comment '客户所属区县的名字',
      month_customer_sum bigint comment '月订单量',
      customer_signed_time string  comment '客户创建时间',
      month_customer_weight_sum decimal(20,2) comment '月订单总重',
      year_customer_sum bigint comment '年订单总量',
      year_customer_weight_sum decimal(20,2) comment '客户年订单总重',
      day_customer_sum bigint comment '日订单总量',
      day_customer_weight_sum decimal(20,2)  comment '日订单总重',
      customer_stage int comment'客户当前状态 1新增 2流失 3挽回 4稳定',
      dt2  date comment'日期'

)
    COMMENT  '客户基础数据报表'
    PARTITIONED BY ( dt STRING COMMENT '日期')
    STORED AS PARQUET
    LOCATION '/dw/hive/jms_dm.db/external/dm_customer_base_data_dt'
    TBLPROPERTIES (
        'discover.partitions' = 'false',
        'parquet.column.index.access' = 'true'
        );